<template>
  <h1>事件绑定指令</h1>
  <button @click="f1">按钮1</button>
  <button v-on:click="f2">按钮2</button>

  <h2>敲回车事件</h2>
  <input type="text" placeholder="请输入你想搜索的关键词"
  v-model="search" @keydown.enter="ent">
</template>

<script setup>
  import {ref} from "vue";
  const f1 = ()=>{
    alert('按钮1被点击了')
  }
  const f2 = ()=>{
    alert('按钮2被点击了')
  }
  const search = ref('');
  const ent = ()=>{
    alert('你输入了'+search.value+'关键词');
  }
</script>

<style scoped>

</style>